package com.xiaoy.core.base.security.role.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.xiaoy.core.base.security.user.entity.UserRole;
import com.xiaoy.entity.BaseBean;
import com.xiaoy.util.store.config.ConfigTable;
@Entity
@Table(name=ConfigTable.Base.ROLE_TABLENAME)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Role extends BaseBean{

	private String name;
	private List<UserRole> userRoles;
	
	public Role(){}
	
	public Role(long id){
		this.id = id;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "role")
	public List<UserRole> getUserRoles() {
		return userRoles;
	}
	
	public void setUserRoles(List<UserRole> userRoles) {
		this.userRoles = userRoles;
	}
	

	
}
